package com.sh.learn.manning.springinaction.chapter01.aop;

import com.sh.learn.manning.springinaction.chapter01.di.GrailNotFoundException;
import com.sh.learn.manning.springinaction.chapter01.di.HolyGrailQuest;
import com.sh.learn.manning.springinaction.chapter01.di.Knight;

public class KnightOfTheRoundTable2 implements Knight {
	
	private String name;
	private HolyGrailQuest quest;
	private Minstrel minstrel;

	public KnightOfTheRoundTable2(String name) {
		this.name = name;
		this.quest = new HolyGrailQuest();
		this.minstrel = new Minstrel();
	}

	public Object embarkOnQuest() throws GrailNotFoundException {
		this.minstrel.singBefore(this);
		Object result = quest.embark();
		this.minstrel.singAfter(this);
		return result;
	}

	public String getName() {
		return name;
	}
	
	
}
